//----------------------------------------------------------------------------
// M A R I T I M E  R E S E A R C H  I N S T I T U T E  N E T H E R L A N D S
//----------------------------------------------------------------------------
// Copyright (C) 2012 - MARIN - All rights reserved - http://www.marin.nl
//----------------------------------------------------------------------------
// Program    : mermaid
// Module     : vbm
// File       : reorder.h
// Author     : M.A. de Jong
//----------------------------------------------------------------------------

#ifndef REORDER_H
#define REORDER_H

#include "kernels/reorder_kernels.h"

namespace wavescomputer
{

template <class T>
inline void reorder(T* dst, T* src, const int size)
{
    int nrbufferblocks = (int)ceil((float)size / NUM_THREADS);

    kernel_reorder<T> 
        <<< nrbufferblocks, NUM_THREADS, 3 * NUM_THREADS * sizeof(T) >>> 
        (dst, src);

    checkCudaError(cudaGetLastError(), "wavescomputer::kernel_reorder");
}

} // namespace wavescomputer

#endif // REORDER_H

